<include file="public:header" />
	   <div class="toptip">
  		<h2>提示：</h2>
  		<p>您可以通过发送测试邮件来调试配置信息。<br />
  		通过连接 SMTP 服务器发送邮件需邮箱账户开通SMTP服务。
  		<br />
  		您可以添加多个SMTP账户，系统将随机使用SMTP账户。
  		</p>
	  </div>
    <div class="toptit">设置</div>
    <form action="{:U('mailconfig/index')}" method="post"   name="form1" id="form1">
    <table width="100%" border="0" cellspacing="8" cellpadding="0" style="padding-left:15px;" id="methodsel">
      <tr>
        <td>
    	<label>
    	<input name="method" type="radio" value="1" <if condition="$info['method'] eq 1">checked="checked"</if>/>
          通过连接 SMTP 服务器发送邮件
    	  </label>
    	  </td>
        </tr>
      <tr>
        <td>
    	<label>
    	<input type="radio" name="method" value="2" <if condition="$info['method'] eq 2">checked="checked"</if>/>
          通过sendmail 发送邮件
    	  </label>
    	</td>
        </tr>
      <tr>
        <td>
    	<label>
    	<input type="radio" name="method" value="3" <if condition="$info['method'] eq 3">checked="checked"</if>/>
         通过 PHP 函数 SMTP 发送邮件
    	  </label>
    	</td>
        </tr>
    </table>
<div style=" display:none1"  id="method_sendmail">
<volist name="list" id="list">
  <div class="html_tpl">
    <table width="700" border="0" cellspacing="8" cellpadding="1" style=" margin-bottom:3px; border-bottom:1px #CCCCCC solid" >
          <tr>
            <td width="121" align="right">SMTP服务器地址：</td>
            <td><input name="smtpservers[]" type="text"  class="input_text_200" id="smtpservers" value="{$list.smtpservers}" maxlength="30"/>
              如：smtp.qq.com</td>
            <td><span style="color:#0066CC; cursor:pointer" class="delsmtp">X 删除此账户</span></td>
          </tr>
          <tr>
            <td align="right">SMTP服务帐户名：</td>
            <td><input name="smtpusername[]" type="text"  class="input_text_200" id="smtpusername" value="{$list.smtpusername}" maxlength="100"/></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td align="right">SMTP服务密码：</td>
            <td><input name="smtppassword[]" type="password"  class="input_text_200" id="smtppassword" value="{$list.smtppassword}" maxlength="40"/></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td align="right">发信人邮件地址：</td>
            <td><input name="smtpfrom[]" type="text"  class="input_text_200" id="site_title" value="{$list.smtpfrom}" maxlength="60"/>            </td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td align="right">SMTP 端口：</td>
            <td><input name="smtpport[]" type="text"  class="input_text_200" id="smtpport" value="{$list.smtpport}" maxlength="60"/>
默认：25</td>
            <td>&nbsp;</td>
          </tr>
      </table>
    </div>
</volist>  
	 <div id="html"></div>
    </div>
	  <table width="700" border="0" cellspacing="8" cellpadding="1"  >
          <tr>
            <td width="120" align="right">&nbsp;</td>
            <td> 
              <input name="save" type="submit" class="admin_submit"    value="保存修改"/>
			        <input type="button" name="add_form" id="add_form" value="继续添加" class="admin_submit" />
            </td>
          </tr>
      </table>
  </form>
</div>
<include file="public:footer" />
<script id="J_email" type="text/html">
  <div class="html_tpl">
  <table width="700" border="0" cellspacing="8" cellpadding="1" style=" margin-bottom:3px; border-bottom:1px #CCCCCC solid" >
        <tr>
          <td width="121" align="right">SMTP服务器地址：</td>
          <td><input name="smtpservers[]" type="text"  class="input_text_200" id="smtpservers" value="" maxlength="30"/>
            如：smtp.qq.com</td>
          <td><span style="color:#0066CC; cursor:pointer" class="delsmtp">X 删除此账户</span></td>
        </tr>
        <tr>
          <td align="right">SMTP服务帐户名：</td>
          <td><input name="smtpusername[]" type="text"  class="input_text_200" id="smtpusername" value="" maxlength="100"/></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="right">SMTP服务密码：</td>
          <td><input name="smtppassword[]" type="password"  class="input_text_200" id="smtppassword" value="" maxlength="40"/></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="right">发信人邮件地址：</td>
          <td><input name="smtpfrom[]" type="text"  class="input_text_200" id="site_title" value="" maxlength="60"/>            </td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td align="right">SMTP 端口：</td>
          <td><input name="smtpport[]" type="text"  class="input_text_200" id="smtpport" value="25" maxlength="60"/>
默认：25</td>
          <td>&nbsp;</td>
        </tr>
    </table>
  </div>
</script>
<script type="text/javascript">
$(document).ready(function()
{
  setsendmailshow();
  $("#methodsel :radio").click(function () {setsendmailshow();});
  function setsendmailshow()
  {
    var stlval=$("#methodsel :radio[checked]").val();
    if (stlval=="1")
    {
    $("#method_sendmail,#add_form").show();
    $("#add_form").show();
    }
    else
    {
    $("#method_sendmail,#add_form").hide();
    }
  }
  $("#add_form").click(function()
  {
    $("#html").append($("#J_email").html());
  });
  
  $(".delsmtp").hover(function(){
  $(this).parentsUntil('div').css('background-color','#F3F3F3');
  },function(){
  $(this).parentsUntil('div').css('background-color','');
  });
  
  $('.delsmtp').live('click', function()
  {
    if ($("#method_sendmail div:nth-child(2)").text()=='')
    {
    alert('至少留一个SMTP账户！');
    }
    else
    {
    $(this).closest('div').empty();
    }
  });
});
</script>
</body>
</html>